package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface CheckGroupMapper {

    /**
     * 分页查询
     * @param queryString
     * @return
     */
    Page<CheckGroup> pageQuery(String queryString);

    /**
     * 新增检查组
     * @param checkGroup
     */
    @Options(useGeneratedKeys = true , keyProperty = "id")
    @Insert("insert into t_checkgroup (code, name, help_code, sex, remark, attention) " +
            "VALUES (#{code},#{name},#{helpCode},#{sex},#{remark},#{attention})")
    void insert(CheckGroup checkGroup);

    /**
     * 根据id删除检查组
     * @param id
     * @return
     */
    @Delete("delete from t_checkgroup where id = #{id}")
    void deleteById(Integer id);

    /**
     * 条件查询
     * @param checkGroup
     * @return
     */
    List<CheckGroup> select(CheckGroup checkGroup);

    /**
     * 修改检查组
     * @param checkGroup
     */
    void update(CheckGroup checkGroup);
}
